{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hello...\n",
      "... World!\n"
     ]
    }
   ],
   "source": [
    "import asyncio\n",
    "\n",
    "async def main():\n",
    "    print(\"Hello...\")\n",
    "    await asyncio.sleep(3)\n",
    "    print(\"... World!\")\n",
    "\n",
    "await main()"
   ]
  },
  {
   "cell_type": "markdown",
   "source": [
    "asyncio提供一组高层及API用于：\n",
    "* 并发的运行Python协程并对其执行过程实现完全控制\n",
    "* 执行网络IO和IPC\n",
    "* 控制子进程\n",
    "* 通过队列实现分布式任务\n",
    "* 同步并发代码"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}